/*
  Copyright notice
  ================
  
  Copyright (C) 2010
      Lorenzo  Martignoni <martignlo@gmail.com>
      Roberto  Paleari    <roberto.paleari@gmail.com>
      Aristide Fattori    <joystick@security.dico.unimi.it>
  
  This program is free software: you can redistribute it and/or modify it under
  the terms of the GNU General Public License as published by the Free Software
  Foundation, either version 3 of the License, or (at your option) any later
  version.
  
  HyperDbg is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  
  You should have received a copy of the GNU General Public License along with
  this program. If not, see <http://www.gnu.org/licenses/>.
  
*/

#ifndef _PILL_COMMON_H
#define _PILL_COMMON_H

#define CORE_VERSION  "20100325"
#define MIN(a,b) (((a)<(b))?(a):(b))

#define MyKeStallExecutionProcessor(x) {			\
    volatile int d, p;						\
    for (d=0; d<x; d++) for (p=0; p<10; p++);			\
  }

/* Assembly functions (defined in i386/common.asm) */
VOID NTAPI CmInitSpinLock(ULONG32 *plock);
VOID NTAPI CmAcquireSpinLock(ULONG32 *plock);
VOID NTAPI CmReleaseSpinLock(ULONG32 *plock);

VOID CmSetBit(ULONG* dword, ULONG bit);
VOID CmClearBit32(ULONG* dword, ULONG bit);
VOID CmClearBit16(USHORT* word, ULONG bit);
int wide2ansi(PUCHAR dst, PUCHAR src, ULONG32 n);

#endif	/* _PILL_COMMON_H */
